/**********************************************************
The class CVSequence consists of a sequence of the class CompositeVent.
The major responsibility of this class is to calculate the output of the composite vents
of a NCU.
Author: Chun-Ming Wang
Date of Modification: 25/16/2007 (dd/mm/yyyy)
**********************************************************/
#pragma once
#ifndef _CVSequence
#define _CVSequence
#include "CompositeVent.h"
#include <vector>
#include <utility>

class CVSequence
{
public:
	// constructors
	CVSequence();
	// CVSequence(const unsigned int &num);
	CVSequence(const vector<CompositeVent*> &seq);
	CVSequence(const CVSequence &seq);
	// destructor
	virtual ~CVSequence();
	// operator assignment
	CVSequence& operator = ( const CVSequence &rhs);
	// access functions
	//get the number of the class CompositeVent contained in the sequence.
	const size_t number() const;
	//Set the number of the class CompositeVent contained in the sequence.
	void number(const size_t &num);
	/*And then set the contents that are pointed by the members contained in the sequence to the
	default state*/
	bool initialize(const vector<double> &paras);
	// add a CompositeVent to the end of the sequence
	void add(const CompositeVent &item);
	// assign values to parameters of the composite vents
	bool parameters(const vector<double> &paras);
	// get values of the composite vents
	vector<double> parameters() const;
	// output
	double output(const double &SillNCU) const;
	// virtual constructor
	CVSequence* clone() const;
protected:
	typedef vector<CompositeVent*> VCOPTR; // vector of composite vent pointers
	typedef vector<CompositeVent*>* PTRVCOPTR; // pointer of the VCOPTR
	typedef vector<CompositeVent*>::const_iterator VCOIter; // alias of the iterator of the VCOPTR
	// initialize the number of the composite vents
	void nAssign(const size_t &num);
	double calc(const double &SillNCU) const;
	// copy the content of the RHS
	void copy(const VCOPTR &rhs);
	// destroy the constent of the m_seq
	void destroy();
protected:
	PTRVCOPTR m_seq; // data member that holds the sequence of composite vents
};
#endif